package com.itheima.controller;

import com.itheima.pojo.*;
import com.itheima.service.NursingLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/nursing/level")
public class NursingLevelController {
    @Autowired
    private NursingLevelService nursingLevelService;
    @GetMapping("/list")
    public Result getAll(ProjectParam projectParam) {
        PageResult pageResult = nursingLevelService.getAll(projectParam);
        return Result.success(pageResult);
    }
    @PostMapping
    public Result addProject(@RequestBody NursingLevel nursingLevel){
        nursingLevelService.addLevel(nursingLevel);
        return Result.success();
    }
    @GetMapping("/{id}")
    public Result getProject(@PathVariable Long id){

        NursingLevel level = nursingLevelService.getLevelById(id);
        return Result.success(level);
    }
    @PutMapping
    public Result updateProject(@RequestBody NursingLevel nursingLevel){
        nursingLevelService.updateLevel(nursingLevel);
        return Result.success();
    }
    @DeleteMapping
    public Result deleteProject(@RequestParam Long id){
        nursingLevelService.deleteLevel(id);
        return Result.success();
    }

}
